package vip.specimen.system.common.enums;

import vip.specimen.system.common.connector.IErrorCodeInterface;

/**
 * *@Author: 余浪人
 * *@Date：2021/2/5 14:45
 * *@Email:yulangren520@Gmail.com
 * *@QQ:1368419640
 **/
public enum ResultCode implements IErrorCodeInterface {
    /**
     * 成功
     */
    SUCCESS(200, "success"),
    /**
     * 错误信息
     */
    ERROR_DELETE(410, "删除失败"),
    ERROR_NOT_FOUND(404, "资源不存在"),
    REQUEST_METHOD_NOT_SUPPORTED(405, "请求方式未定义"),
    ERROR_NOT_LOGIN(406, "未登录或登录过期"),
    ERROR_HTTP_MEDIA_TYPE_NOT_SUPPORTED(407, "请求头ContentType参数错误"),
    ERROR_NOT_PERMISSION(403, "未取得操作权限，请联系管理员授权"),
    ERROR_UPLOAD_NOT_EMPTY(405, "上传文件不可为空"),
    ERROR_UPLOAD_FAILED(405, "上传文件失败"),
    ERROR_SAVE_NOT_EMPTY(406, "没有此存储方式"),
    ERROR_UPLOAD_NOT_ALLOW(407, "该文件不允许上传或系统没有分类"),


    /**
     * 服务器错误
     */
    ERROR_SERVER(500, "server error"),

    /**
     * sql 数据库操作失败
     */
    ERROR_SQL_CREATE_SERVER(510, "创建数据失败"),
    ERROR_SQL_UPDATE_SERVER(511, "更新数据失败"),
    ERROR_NULL_POINTER(512, "发生空指针异常"),
    ERROR_HTTP_MESSAGE_NOT_READABLE(513, "无法对参数进行序列化"),
    ERROR_NOT_EXECUTABLE_CURRENT(514, "不可操作自己哦"),
    /**
     * 参数错误
     */
    ERROR_PARAMETER(600, "参数有误或验证不合法"),
    //    数据验证失败
    DATA_VALIDATION_FAIL(601, "数据验证失败"),
    DATA_VALIDATION_PASSWORD_FAIL(602, "密码错误"),
    DATA_VALIDATION_USER_FAIL(603, "该用户不存在或被限制登录"),
    DATA_VALIDATION_CODE_FAIL(604, "验证码错误"),
    DATA_UNREPEATABLE_CODE_INSERT(605, "受系统保护 => 操作无效"),
    UNABLE_TO_ACQUIRE_JDBC_CONNECTION(607, "无法获取JDBC连接"),
    INVALID_DATA_ACCESS_RESOURCE_USAGE(608, "无效的数据资源服务(数据表不存在)"),
    CANNOT_CREATE_TRANSACTION(608, "建立事务失败"),
    DATA_FREE_MEM(606, "当前数据已被使用"),
    INVALID_OPERATION(607, "无效的操作");
    private long status;
    private String msg;


    ResultCode(long status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    @Override
    public long getStatus() {
        return status;
    }

    @Override
    public String getMessage() {
        return msg;
    }
}
